FROM harbor.where25.cn/tools/python:3.8-slim
# 工作目录
ARG WORK_DIR="/usr/src/app"


# 修改源
# RUN echo 'deb http://deb.debian.org/debian bookworm-backports main' >> /etc/apt/sources.list
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources

# # 修改时区
ENV TZ=Asia/Shanghai \
    DEBIAN_FRONTEND=noninteractive

RUN ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime \
    && echo ${TZ} > /etc/timezone \
    && dpkg-reconfigure --frontend noninteractive tzdata \
    && rm -rf /var/lib/apt/lists/*

# # 安装debian 必要依赖
ARG PACKAGES="curl libfontconfig"
RUN apt update && apt install -y ${PACKAGES} && apt-get clean

# 设置工作目录
RUN mkdir -p ${WORK_DIR}
WORKDIR ${WORK_DIR}




# 添加依赖（利用Docker 的缓存）
ADD ./requirements ${WORK_DIR}/requirements

# 安装依赖
# ARG PIP_URL="https://pypi.douban.com/simple/"
ARG PIP_URL="https://mirrors.aliyun.com/pypi/simple/"
RUN pip install -r requirements/prod.txt -i ${PIP_URL} && rm -rf ~/.cache/pip

# 添加应用
ADD . ${WORK_DIR}

# 运行服务
CMD ["/bin/sh", "./scripts/start_server.sh"]